package com.nstc.sftpExchange.config.sftp;

import lombok.Data;

import java.util.Objects;


@Data
public class FtpConnectionKey {
    /**
     * 协议，默认：SFTP
     */
    private String protocol= "SFTP";
    /**
     * SFTP服务器IP或域名
     */
    private String host;
    /**
     * SFTP服务器接口
     */
    private int port=22;
    /**
     * SFTP用户名
     */
    private String username;
    /**
     * SFTP密码
     */
    private String password;
    /**
     * 免密登录的私钥地址
     */
    private String privateKeyPath;

    /**
     * 连接名称
     */
    private String name;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FtpConnectionKey that = (FtpConnectionKey) o;
        return port == that.port &&
                Objects.equals(this.protocol, that.protocol) &&
                Objects.equals(this.host, that.host) &&
                Objects.equals(this.username, that.username) &&
                Objects.equals(this.name, that.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(protocol, host, port, username, name);
    }
}